package day03;

import java.util.Arrays;

/**
 * Created by MGL on 2017/4/4.
 */
public class Test04 {
    public static void main(String[] args) {
        int d[] = new int[12];
        d[0] = 0;
        for (int i = 1; i <= 11; i++) {
            int count1 = test(i - 1, d, i);
            int count2 = test(i - 3, d, i);
            int count3 = test(i - 5, d, i);
            int temp = count1 < count2 ? count1 : count2;
            d[i] = (temp < count3 ? temp : count3) + 1;
        }
        System.out.println(Arrays.toString(d));
    }

    private static int test(int num, int[] d, int index) {
        if (num >= 0) {
            return d[num];
        } else {
            return Integer.MAX_VALUE;
        }
    }
}
